package com.cnplan.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.cnplan.entity.GisKxjfEntity;
import com.cnplan.entity.GisQjsgcEntity;
import com.cnplan.vo.QjsgcVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface GisQjsgcMapper extends BaseMapper<GisQjsgcEntity> {
    @Select(value = "SELECT *,st_asgeojson(geom) as geojson FROM \"gis_qjsgc\" WHERE st_intersects(st_pointfromtext('point(${x} ${y})', st_srid(geom)),geom)=TRUE")
    List<GisQjsgcEntity> getAllByGeom(@Param("x") String x, @Param("y") String y);

    @Select(value = "SELECT objid,gcxkz FROM \"gis_qjsgc\" WHERE gcxkz like '%${gcxkz}%'")
    List<QjsgcVo> getQjsgc(@Param("gcxkz") String gcxkz);

    @Select(value = "SELECT *,st_asgeojson(geom) as geojson FROM \"gis_qjsgc\" WHERE objid =#{id}")
    GisQjsgcEntity getQjsgcById(@Param("id") int id);
}
